#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int isLeapyear(int year) {
	if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
		return 1;
	}
	else {
		return 0;
	}
}

int main() {
	int flag, year, month, day;
	int p[2][12] = { {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} };
	scanf("%d-%d-%d", &year, &month, &day);
	flag = isLeapyear(year);
	for (int i = 0; i < month - 1; i++) {
		day += p[flag][i];
	}
	printf("%d", day);
	return 0;
}